var _pInfo = {
	"qrcode": null,
	"userInfo": null,
	"param": getQueryParams(),
	"renderData": function() {
		AjaxRequest({
			url: _url + "/money/user/usermsg",
			type: "post",
			load: true,
			data: {
				"userid": _pInfo.userInfo["id"]
			},
			success: function(rs) {
				if(isReqSucceed(rs)) {
					_pInfo.userInfo = rs.data;
					$("#wallet-content").html(template("wallet-content-tpl", {
						rs: rs.data,
						url: imgUrl
					}));
					var codeVal = "";
					if(rs.data.email != "") {
						codeVal = rs.data.email;
					}
					if(rs.data.tel != "") {
						codeVal = rs.data.tel;
					}
					_pInfo.qrcode = new QRCode(document.getElementById("qrcode"));
					_pInfo.qrcode.makeCode(codeVal);
				}
			}
		});
	},
	"copyAccount": function() {
		//		if(document.execCommand('copy')) {
		//			document.execCommand('copy');
		//			alert('复制成功');
		//		}
	},
	"loadEvents": function() {
		_pInfo.userInfo = _user.getUserInfo();
		var clipboard = new ClipboardJS('#submit-btn');
		clipboard.on('success', function(e) {
			alert("复制到粘贴板成功");
			e.clearSelection();
		});
		clipboard.on('error', function(e) {
			console.error('Action:', e.action);
			console.error('Trigger:', e.trigger);
		});
	},
	"load": function() {
		this.loadEvents();
		this.renderData();
	}
}
exposeGlobalMethods({
	"copyAccount": function() {
		_pInfo.copyAccount();
	},
});
$(function() {
	_pInfo.load();
});